package demo01extends;

import java.util.ArrayList;

/*
    自定义4个Student对象添加到集合，并遍历
*/
public class Demo05ArrayListStudent {
    public static void main(String[] args) {
        ArrayList<Student> list = new ArrayList<>();
        list.add(new Student("zhang"));
        Student two = new Student("wang");
        Student three = new Student("li");
        Student four = new Student("zhao");
        list.add(two);
        list.add(three);
        list.add(four);
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i).getName());
        }
    }
}
